package com.pgybook.db.entity.mapper;

import org.springframework.stereotype.Repository;
import com.pgybook.db.entity.domain.CashDailyAnalysis;
import com.pgybook.db.entity.domain.CashDailyAnalysisEx;
import com.pgybook.db.entity.domain.CashDailyAnalysisKey;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Repository
public interface CashDailyAnalysisMapper {
    int countByExample(CashDailyAnalysisEx example);

    int deleteByExample(CashDailyAnalysisEx example);

    @Delete({
            "delete from cashdailyanalysis",
            "where LIBID = #{libid,jdbcType=INTEGER}",
            "and BZDAY = #{bzday,jdbcType=DATE}",
            "and TYPE = #{type,jdbcType=INTEGER}",
            "and SUBTYPE = #{subtype,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(CashDailyAnalysisKey key);

    @Insert({
            "insert into cashdailyanalysis (LIBID, BZDAY, ",
            "TYPE, SUBTYPE, TRANSNUM, ",
            "TOTAL)",
            "values (#{libid,jdbcType=INTEGER}, #{bzday,jdbcType=DATE}, ",
            "#{type,jdbcType=INTEGER}, #{subtype,jdbcType=INTEGER}, #{transnum,jdbcType=INTEGER}, ",
            "#{total,jdbcType=DECIMAL})"
    })
    int insert(CashDailyAnalysis record);

    int insertSelective(CashDailyAnalysis record);

    List<CashDailyAnalysis> selectByExample(CashDailyAnalysisEx example);

    @Select({
            "select",
            "LIBID, BZDAY, TYPE, SUBTYPE, TRANSNUM, TOTAL",
            "from cashdailyanalysis",
            "where LIBID = #{libid,jdbcType=INTEGER}",
            "and BZDAY = #{bzday,jdbcType=DATE}",
            "and TYPE = #{type,jdbcType=INTEGER}",
            "and SUBTYPE = #{subtype,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    CashDailyAnalysis selectByPrimaryKey(CashDailyAnalysisKey key);

    int updateByExampleSelective(@Param("record") CashDailyAnalysis record, @Param("example") CashDailyAnalysisEx example);

    int updateByExample(@Param("record") CashDailyAnalysis record, @Param("example") CashDailyAnalysisEx example);

    int updateByPrimaryKeySelective(CashDailyAnalysis record);

    @Update({
            "update cashdailyanalysis",
            "set TRANSNUM = #{transnum,jdbcType=INTEGER},",
            "TOTAL = #{total,jdbcType=DECIMAL}",
            "where LIBID = #{libid,jdbcType=INTEGER}",
            "and BZDAY = #{bzday,jdbcType=DATE}",
            "and TYPE = #{type,jdbcType=INTEGER}",
            "and SUBTYPE = #{subtype,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(CashDailyAnalysis record);
}
